package com.zhangzc.sc.scquery.Controller;


import com.zhangzc.sc.scquery.Esconfig.ElasticsearchConfig;
import com.zhangzc.sc.scquery.Utils.EsUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/es")
public class EsController {
    @Autowired
    private ElasticsearchConfig elasticsearchConfig;

    @Autowired
    EsUtils esUtils;
    /**
     * 创建索引，不带任何的参数
     * */
    @GetMapping("/{index}")
    public void index(@PathVariable String index) {
        esUtils.createIndex(index);
        System.out.println(elasticsearchConfig);
    }
}
